define([
	"UtilDir/util",
	"UtilDir/tool",
    "UtilDir/org/selectOrg",
    "UtilDir/searchBlock",
    "UtilDir/fileupload/singleFileUpload",
	"Date","DateCN", "css!DateCss",
	"EasyUI","EasyUI-lang"
    ],function(Util, Tool, SelectOrg, SearchBlock,SFU){

	/**
	 * 页面初始化
	 */
	var init = function(){
        /*fileUpload(1,'0538ea59f1ce4f208fc7e65c40dce8dd');
        fileUpload(2,'e9229023f3574c5ab03c45fc0f61c694');
        fileUpload(3,'7b508a99af4347c9ae6248226290b518');*/
        //fileUpload(1,'8df17ea305834066839be5b4632044b4');
        //fileUpload(1,'13edbae079a444af8c9518a35fa12aba');
        //45f6cb99788f4641a30ceabd26bca1d0
        //fileUpload(1,'dc2402b9b1964190b1f828175ac22e69');
        //fileUpload(2,'d9b36a174c7a46e296f58972b9688e6d');

        fileUpload(1,'9538e82ff21546fca100bdd2fc5f9139');
        fileUpload(2,'f0c6812086464b168fb5a09cba17734b');
        fileUpload(3,'6a6e94fea715484c833565cd762f2b00');
        fileUpload(4,'2c8d70a37f714db88c43da6187e4dcc1');
        fileUpload(5,'087348cb3e194134b7898d18dfcca194');
        fileUpload(6,'26217f87da024bb9be68ff030056418b');
        // fileUpload(1,'');
        // fileUpload(2,'');
        // fileUpload(3,'');
        // fileUpload(4,'');

        // $("#fileId").val('8d79c1354320463a9572630abcfd2381');
        // var data = {'fileId':'c984ef0ea9294bf7bbe739724bed5e2b'};
        // Tool.deserialize("sfuForm", data);
        $(".fa-times").css('display','none');


	};
    var FILE_TYPES = {
        image: {
            title: '图片文件',
            extensions: 'jpg,jpeg,bmp,png,ico',
            mimeTypes: 'image/bmp,image/jpeg,image/png,image/x-icon'
        },
        imagePdfVideo: {
            title: '图片文件',
            extensions: 'jpg,jpeg,bmp,png,ico,pdf,mp4,avi,mov,mpg',
            mimeTypes: 'image/bmp,image/jpeg,image/png,image/x-icon,application/pdf,video/mpeg,video/quicktime,video/x-msvideo,application/vnd.rn-realmedia-vbr,video/mp4'
        },
        doc: {
            title: '文档文件',
            extensions: 'doc,docx,xls,xlsx,ppt,pptx,pdf',
            mimeTypes: 'application/vnd.ms-excel.12,application/vnd.ms-word.document.12,application/vnd.ms-powerpoint.12,' +
                'application/pdf,application/vnd.ms-excel,application/vnd.ms-powerpoint,application/msword'
        },
        video: {
            title: '视频文件',
            extensions: 'mp4,avi,mov,mpg,doc,docx,xls,xlsx,ppt,pptx,pdf,jpg,jpeg,bmp,png,ico',
            mimeTypes: 'video/mpeg,video/quicktime,video/x-msvideo,'
                + 'application/vnd.rn-realmedia-vbr,video/mp4' + 'application/vnd.ms-excel.12,application/vnd.ms-word.document.12,application/vnd.ms-powerpoint.12,' +
                'application/pdf,application/vnd.ms-excel,application/vnd.ms-powerpoint,application/msword' + 'image/bmp,image/jpeg,image/png,image/x-icon'
        },
        audio: {
            title: '音频文件',
            extensions: 'wma,mp3,wav',
            mimeTypes: 'audio/x-ms-wma,audio/mpeg,audio/x-wav'
        },
        packet: {
            titil: '压缩包',
            extensions: 'zip,rar',
            mimeTypes: 'application/zip,application/x-rar-compressed'
        }
    };
    var initFileUpload = function (n) {
        var settings = {
            placeAt: "singleFileUpload"+n,
            allowMC:false,
            // accept: FILE_TYPES.imagePdfVideo, //作品文件传图片、pdf、视频
            // fileSizeLimit: 200*1024*1024,
            data: $("#fileId"+n).val(),
            onUploadSuccess: function (file) {
                console.log(file);
                // $("#fileId").val(file.attachId);
            },
            onDeleteSavedFile: function (file) {
                console.log(file);
                //调用修改接口，将这一条数据的文件id置空
                // $("#fileId").val("");
                // var data = Tool.serialize("sfuForm");
            },
            onBeforeFileQueued: function (file) {
                console.log(file);
                // 选择完文件后（点击上传之前）的回调
            }
        };
        SFU.init(settings);
    }
    var fileUpload = function (n,id) {
        $("#fileId"+n).val(id);
        initFileUpload(n);
        // $("#deletePlatformFile").css("display","none");
    }


	return {
		init:init
	};
});
